package com.ws.shop.entity;

import java.util.Date;
import java.util.LinkedList;
import java.util.List;

import com.ws.shop.util.StringUtil;

public class ArticleCategories extends BaseEntity{
	private int id;
	private String name;
	private String path;
	private int single;
	private int fid;
	private int ord;
	private int type;//页面模板类型 1:普通单页模板 2:带左侧树形栏的页面模板 3:带左侧树形栏的导航页模板
	private Date addtime;
	private List<String> pathList = new LinkedList<String>();
	private List<ArticleCategories> children = new LinkedList<ArticleCategories>();
	private List<Article> articleList = new LinkedList<Article>();
	
	public final static String PATH_SPACTOR = ";";
	
	public void test(ArticleCategories ac){
		if(ac.children.size() > 0){
			test(ac);
		}
	}
	
	public ArticleCategories(){}
	
	public ArticleCategories(int id, String name,String path,int single,int fid,int ord,Date addtime) {
		this.id = id;
		this.name = name;
		this.path = path;
		this.single = single;
		this.fid = fid;
		this.ord = ord;
		this.addtime = addtime;
	}

	public List<ArticleCategories> getChildren() {
		return children;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public void setChildren(List<ArticleCategories> children) {
		this.children = children;
	}

	public List<String> getPathList() {
		if(!StringUtil.isEmpty(path)){
			pathList.clear();
			String[] arr = path.split(PATH_SPACTOR);
			for(String str : arr){
				if(StringUtil.isEmpty(str)){
					continue;
				}
				pathList.add(str);
			}
		}
		return pathList;
	}

	public List<Article> getArticleList() {
		return articleList;
	}

	public void setArticleList(List<Article> articleList) {
		this.articleList = articleList;
	}

	public int getSingle() {
		return single;
	}

	public void setSingle(int single) {
		this.single = single;
	}

	public int getOrd() {
		return ord;
	}

	public void setOrd(int ord) {
		this.ord = ord;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}
	public int getFid() {
		return fid;
	}

	public void setFid(int fid) {
		this.fid = fid;
	}

	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public Date getAddtime() {
		return addtime;
	}

	public void setAddtime(Date addtime) {
		this.addtime = addtime;
	}
	
}
